﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using STLGROUP.Layers.Common;
using STLGROUP.Layers.DataAccessLayers;
using STLGROUP.Layers.Base;
using System.Data.Objects;
using System.Data;

namespace STLGROUP.Layers.BLL
{
    public class DT_KhachHangBLL : BaseBLL
    {
        public string GetNewMaKhachHang(int IDKhachHang)
        {
            return "KH" + IDKhachHang.ToString().PadLeft(3, '0');
        }

        public IQueryable<DT_KhachHang> GetData()
        {
            return this.Context.DT_KhachHang;
        }

        public void UpdateKhachHang(IQueryable<DT_KhachHang> data)
        {
            if (data != null)
            {
                foreach (DT_KhachHang item in data)
                {
                    //if(item.TrackingState== 
                    item.MaKhachHang = GetNewMaKhachHang(item.IDKhachHang);                         
                }
                //return this.Context.SaveChanges();
            }
            //return -1;
        }

    }
}
